/*******************************************************************************
 * Copyright 2011 Google Inc. All Rights Reserved.
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *******************************************************************************/
package com.hiep.connect.client;

import java.util.List;

import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
import com.hiep.connect.shared.MyUser;
import com.hiep.connect.shared.PostingThread;

@RemoteServiceRelativePath("UserRpcService")
public interface UserRpcService extends RemoteService {
	/**
	 * Utility class for simplifying access to the instance of async service.
	 */
	public static class Util {
		private static UserRpcServiceAsync instance;

		public static UserRpcServiceAsync getInstance() {
			if (instance == null) {
				instance = GWT.create(UserRpcService.class);
			}
			return instance;
		}
	}

	public MyUser login(String email, String password)
			throws IllegalArgumentException;

	public MyUser login(MyUser user) throws IllegalArgumentException;

	public void update(MyUser user) throws IllegalArgumentException;

	public MyUser login(String requestUri);

	public void logout(MyUser user) throws IllegalArgumentException;

	public MyUser register(String email, String password)
			throws IllegalArgumentException;

	public List<MyUser> getAll() throws IllegalArgumentException;

	public List<MyUser> searchFor(String searchFor)
			throws IllegalArgumentException;

	public void addPendingFriend(MyUser pendingFriend, List<MyUser> targets)
			throws IllegalArgumentException;

	public void postOnFriend(MyUser source, MyUser target, PostingThread thread)
			throws IllegalArgumentException;

	public void acceptFriends(MyUser user, List<MyUser> newFriends)
			throws IllegalArgumentException;

}
